--- /dev/null
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include "gdkclipboardprivate.h"
+#include "gdkclipboard-wayland.h"
+
+
+typedef struct _GdkWaylandClipboardClass GdkWaylandClipboardClass;
+
+struct _GdkWaylandClipboard
+{
+ GdkClipboard parent;
+};
+
+struct _GdkWaylandClipboardClass
+{
+ GdkClipboardClass parent_class;
+};
+
+G_DEFINE_TYPE (GdkWaylandClipboard, gdk_wayland_clipboard, GDK_TYPE_CLIPBOARD)
+
+static void
+gdk_wayland_clipboard_finalize (GObject *object)
+{
+ //GdkWaylandClipboard *cb = GDK_WAYLAND_CLIPBOARD (object);
+
+ G_OBJECT_CLASS (gdk_wayland_clipboard_parent_class)->finalize (object);
+}
+
+static void
+gdk_wayland_clipboard_class_init (GdkWaylandClipboardClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ //GdkClipboardClass *clipboard_class = GDK_CLIPBOARD_CLASS (class);
+
+ object_class->finalize = gdk_wayland_clipboard_finalize;
+
+#if 0
+ clipboard_class->claim = gdk_wayland_clipboard_claim;
+ clipboard_class->store_async = gdk_wayland_clipboard_store_async;
+ clipboard_class->store_finish = gdk_wayland_clipboard_store_finish;
+ clipboard_class->read_async = gdk_wayland_clipboard_read_async;
+ clipboard_class->read_finish = gdk_wayland_clipboard_read_finish;
+#endif
+}
+
+static void
+gdk_wayland_clipboard_init (GdkWaylandClipboard *cb)
+{
+}
+
+GdkClipboard *
+gdk_wayland_clipboard_new (GdkDisplay *display)
+{
+ GdkWaylandClipboard *cb;
+
+ cb = g_object_new (GDK_TYPE_WAYLAND_CLIPBOARD,
+ "display", display,
+ NULL);
+
+ return GDK_CLIPBOARD (cb);
+}
--- /dev/null
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2017 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GDK_CLIPBOARD_WAYLAND_H__
+#define __GDK_CLIPBOARD_WAYLAND_H__
+
+#include "gdk/gdkclipboard.h"
+
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_WAYLAND_CLIPBOARD (gdk_wayland_clipboard_get_type ())
+#define GDK_WAYLAND_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_WAYLAND_CLIPBOARD, GdkWaylandClipboard))
+#define GDK_IS_WAYLAND_CLIPBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_WAYLAND_CLIPBOARD))
+
+typedef struct _GdkWaylandClipboard GdkWaylandClipboard;
+
+GType gdk_wayland_clipboard_get_type (void) G_GNUC_CONST;
+
+GdkClipboard * gdk_wayland_clipboard_new (GdkDisplay *display);
+
+
+G_END_DECLS
+
+#endif /* __GDK_CLIPBOARD_WAYLAND_H__ */
#include <string.h>
#include <gdk/gdkwindow.h>
#include <gdk/gdktypes.h>
+#include "gdkclipboard-wayland.h"
+#include "gdkclipboardprivate.h"
#include "gdkprivate-wayland.h"
#include "gdkseat-wayland.h"
#include "gdkwayland.h"
uint32_t keyboard_time;
uint32_t keyboard_key_serial;
+ GdkClipboard *clipboard;
+ GdkClipboard *primary_clipboard;
struct gtk_primary_selection_device *primary_data_device;
struct wl_data_device *data_device;
GdkDragContext *drop_context;
/* FIXME: destroy data_device */
g_clear_object (&seat->keyboard_settings);
g_clear_object (&seat->drop_context);
+ g_clear_object (&seat->clipboard);
+ g_clear_object (&seat->primary_clipboard);
g_hash_table_destroy (seat->touches);
gdk_window_destroy (seat->foreign_dnd_window);
zwp_tablet_seat_v2_destroy (seat->wp_tablet_seat);
seat->wl_seat);
gtk_primary_selection_device_add_listener (seat->primary_data_device,
&primary_selection_device_listener, seat);
+ seat->primary_clipboard = gdk_wayland_clipboard_new (display);
+ }
+ else
+ {
+ /* If the compositor doesn't support primary clipboard,
+ * just do it local-only */
+ seat->primary_clipboard = gdk_clipboard_new (display);
}
seat->data_device =
wl_data_device_manager_get_data_device (display_wayland->data_device_manager,
seat->wl_seat);
+ seat->clipboard = gdk_wayland_clipboard_new (display);
seat->drop_context = _gdk_wayland_drop_context_new (display,
seat->data_device);
wl_data_device_add_listener (seat->data_device,
seat);
}
+ if (display->clipboard == NULL)
+ display->clipboard = g_object_ref (seat->clipboard);
+ if (display->primary_clipboard == NULL)
+ display->primary_clipboard = g_object_ref (seat->primary_clipboard);
+
gdk_display_add_seat (display, GDK_SEAT (seat));
}
gdk_wayland_sources = files([
'gdkapplaunchcontext-wayland.c',
+ 'gdkclipboard-wayland.c',
'gdkcursor-wayland.c',
'gdkdevice-wayland.c',
'gdkdisplay-wayland.c',